package com.lihan.GetSeatInLib.Domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 
 * @ClassName: FloorModel
 * @Description: 楼层模型
 * @author ASUS
 * @date 2022年1月10日
 *
 */
@Entity
@Table(name = "t_floor")
@ApiModel("楼层数据模型")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
public class FloorModel {
	
	/**
	 * 楼层逐渐ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@ApiModelProperty("楼层主键")
	@Column(name = "floor_id")
	private int ID;
	
	/**
	 * 楼层别名，可以取个别名叫XX阁
	 */
	@ApiModelProperty("楼层别名")
	@Column(name = "floor_name",length = 20)
	private String Alias;
	
	/**
	 * 楼层的物理层数
	 */
	@ApiModelProperty("楼层的物理层数")
	@Column(name = "floor_index")
	private int theIndex; 
	
	/**
	 * 所属的桌子
	 */
	@ApiModelProperty("下属的桌子")
	@OneToMany(cascade = CascadeType.PERSIST,fetch = FetchType.EAGER)
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinColumn(name = "floor_table_id")
	private Set<LibTable> tables;

	public FloorModel(int iD, String alias, int theIndex, Set<LibTable> tables) {
		super();
		ID = iD;
		Alias = alias;
		this.theIndex = theIndex;
		this.tables = tables;
	}

	public int getID() {
		return ID;
	}

	public void setID(int iD) {
		ID = iD;
	}

	public String getAlias() {
		return Alias;
	}

	public void setAlias(String alias) {
		Alias = alias;
	}

	public int getTheIndex() {
		return theIndex;
	}

	public void setTheIndex(int theIndex) {
		this.theIndex = theIndex;
	}

	public Set<LibTable> getTables() {
		return tables;
	}

	public void setTables(Set<LibTable> tables) {
		this.tables = tables;
	}

	public FloorModel() {
		
	}
	

	
}
